﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ZWL.Common.Module;
using DAL;
using System.Collections.Generic;
using Model;

public partial class top : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            literalNav.Text = this.GetNavHeader() + this.GetNavBody() + this.GetNavFooter();
            this.LabUserName.Text = getUserName();
            this.Labdeprm.Text = getGroupID();
        }
    }
    private string GetNavFooter()
    {

        return "</ul>";
    }

    private string GetNavBody()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        //sb.Append("<li id=\"man_nav_1\" onclick=\"list_sub_nav(id,'管理首页')\" class=\"bg_image_onclick\">管理首页</li>");
        IList<ERPMenu> rights = Factory.getERPMenuDAL().ERPMenu_getByRoleId(getRoleId());
        foreach (ERPMenu right in rights)
        {
            sb.AppendFormat("<li id=\"{0}\" onclick=\"list_sub_nav(id,'{1}')\"class=\"bg_image\">{2}</li>", right.MenuId, right.MenuName, right.MenuName);
        }

        return sb.ToString();
    }

    private string GetNavHeader()
    {
        return "<ul>";
    }
}
